<template>
  <div class="index-back">
    <ul class="list">
      <li class="list-pub" v-for="(item, index) in $store.state.rataData" :key="index" v-if="item.isSelect == '已选'">
          <mt-cell-swipe
              :right="[
                  {
                      content: '删除',
                      style: { background: '#ff7900', color: '#fff', width: '80px'},
                      handler: () => deleteSection(item.en)
                  }
              ]">
              <div class="main-box">
                <div class="main-text">
                  <p class="section">{{item.en}}</p>
                  <p class="teacher">{{item.zh}}</p>
                </div>
                <input type="number" v-model="item.value"  placeholder="0.00" :id="item.id" @input="changeCell(item)">
              </div>
          </mt-cell-swipe>
      </li>
    </ul>
    <div class="login-btn" @click="addCell">添加</div>

  </div>
</template>

<script>
  export default {
    data() {
      return {
        value: '',
        scroll: ''
      }
    },
    methods: {
      deleteSection: function (id) {
        this.$store.commit('removeRata', id)
      },
      addCell: function () {
        this.$router.push({name: 'cell'})
      },
      changeCell: function (item) {
        this.$store.commit('changeRata', [item.value,item.rate])
      },
      myTouchMove: function () {
        document.activeElement.blur()
      }
    },
    mounted: function () {
      window.addEventListener("touchmove",this.myTouchMove)
    },
    watch: {
    }
  }
</script>

<style>
.index-back{
}
.mint-cell{
  background: transparent;
}
.list{
  padding-top: 1.333333rem;
  background: #fdd802;
}
.list-pub{
  border-bottom: #fafafa solid 1px;
  background: #fff;

}
.list-pub:first-child{
  background: #fdd802 url(../assets/img/indexback.jpg) no-repeat bottom center;
  background-size: 100%;
}
.main-box{
  width: 10.0rem;
  height: 2.4rem;
  position: relative;
  color: #000;
}
.main-text{
  position: absolute;
  left: 0.693333rem;
  top: 0.5rem;
  font-size: 0.4rem;
  line-height: 0.6rem;
  text-align: left;
}
.list-pub:first-child .main-box input{
  font-size: 1.2rem;
}
.main-box input{
  display: block;
  width: 100%;
  padding: 0.5rem 0;
  height: 1.4rem;
  position: absolute;
  right: 0.613333rem;
  top: 0;
  background: transparent;
  text-align: right;
  font-size: 0.8rem;
  color: #000;
}
input::-webkit-input-placeholder {
  color: #000;
}
.mint-cell-wrapper{
  padding: 0
}
.mint-cell-swipe-button{
  line-height: 2.4rem;
}
.index-back .mint-cell-wrapper{
  background-size: 120% 0px;
}
.login-btn{
  width: 60%;
  margin-left: 20%;
  height: 1.013333rem;
  margin-top: 1.066667rem;
  border-radius: 0.68rem;
  background: linear-gradient(to right, #fcba13, #fce604);
  font-size: 0.373333rem;
  color: #fff;
  line-height: 1.013333rem;
  box-shadow: 0 0 5px 5px rgba(0,0,0,0.05);
}
.list-pub .mint-cell:last-child{
  background-size: 100% 0;
}
</style>